home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / August 96 / Re Undo Set Property.3 < prev    next >
Encoding:
Internet Message Format  |  1996-08-07  |  3.3 KB  |  [TEXT/ttxt]

  1. Subject:     Re:Undo Set Property
  2. Sent:        8/7/96 3:45 PM
  3. Received:    8/7/96 3:43 PM
  4. From:        Greg Friedman, friedman@cognosis.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Greg Friedman wrote (in response to Serge) :
  9. > > May I suggest that FW_CPropertyDesignator call a method of FW_CPart to
  10. > > create the FW_CSetPropertyCommand? If you can do this or something similar
  11. > > for ODF 2, I will file my incomplete Undo support as a bug to be corrected
  12. > > once ODF 2 is out.
  13. >
  14. > This is a good suggestion, though I think it should be a virtual method of
  15. > FW_MScriptable, not of FW_CPart.
  16.  
  17. I've thought more about this, and examined a couple of possible designs. In
  18. the end, I think the best bet is to stick with the current implementation,
  19. with one minor addition. I'll explain the thinking behind not adding a
  20. method first, and then I'll explain the modification that I am making.
  21.  
  22. FW_CSetPropertyCommand has a very close relationship with
  23. FW_CPropertyDesignator. Much of the code in FW_CPropertyDesignator exists
  24. to deal with issues related to multiple undo and clearing of the undo
  25. stack. A close read of this code will reveal that designators become
  26. "dependent" on the objects they reference, and vice versa. There is a
  27. mechanism in place for bidrectional notification to prevent dangling
  28. pointers when objects are deleted that have undoable commands on the undo
  29. stack.
  30.  
  31. What Serge wants to do is perfectly acceptable, but I think it is unusual
  32. and does not represent what 80% or more of ODF users need to do.
  33. Furthermore, I think the likelihood of introducing bugs by trying to
  34. replace the functionality of the SetPropertyCommand is high. It took quite
  35. a bit of work to iron out these classes, and to make them work correctly
  36. within the world of multiple undo and the undo stack.
  37.  
  38. What I am doing: I am adding a new method called
  39. FW_MScriptable::SaveProperty. This method will be called by
  40. FW_CSetPropertyCommand in the place of GetProperty. By default, this method
  41. will just call GetProperty. I believe this should provide a solution for
  42. Serge.
  43.  
  44. Currently, there is no way to distinguish between a GetProperty call
  45. resulting from an AppleScript request for a property versus a call by
  46. FW_CSetPropertyCommand for the purpose of saving a property value for redo.
  47. In the former case, you always want to return just the property value the
  48. user requested. In the latter case, you may want to save additional state
  49. information for redo (perhaps other properties, or private data).
  50.  
  51. With the new method, you can put whatever private data you want into the
  52. FW_CDesc passed to SaveProperty. If you want to save more than a single
  53. property, you can make the descriptor into a record, and put whatever you
  54. want into it.
  55.  
  56. This mechanism should make the GetProperty undo mechanism more flexible,
  57. while still relying on the existing property designator and set property
  58. command.
  59.  
  60. ODF users who insist on using a mechanism other than the built in property
  61. designator and set property command should override
  62. FW_MScriptable::GetContainedObject and, in the case of a property request,
  63. return something other than an FW_CPropertyDesignator. There is nothing
  64. preventing this in ODF 1 or ODF 2.
  65.  
  66. Greg.
  67.  
  68.  
  69. ___________________________________________________________
  70.  Greg Friedman       ODF Engineering        Apple Computer
  71.  
  72.  
  73.